package com.asha.md360player4android.vr.display;

import android.content.Context;
import android.graphics.Point;
import android.util.Log;

import com.asha.vrlib.MD360Director;
import com.asha.vrlib.strategy.display.DisplayModeManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hzqiujiadi on 16/3/19.
 * hzqiujiadi ashqalcn@gmail.com
 */
public class SingleStrategy2 extends AbsBlockStrategy {
    private static int DISPLAY_SIZE = 1;

    public SingleStrategy2(DisplayModeManager.Params params) {
        super(params);
    }

    @Override
    public void turnOnInGL(Context context) {
        List<MD360Director> directors = getDirectorList();
        directors.get(0).reset();
        directors.get(0).setEyeZ(0f);
        directors.get(0).setDeltaXEx(-90f);
        directors.get(0).setDeltaYEx(-270f);
    }

    @Override
    public void turnOffInGL(Context context) {
    }

    @Override
    public boolean isSupport(Context context) {
        return true;
    }

    @Override
    public void onResume(Context context) {

    }

    @Override
    public void onPause(Context context) {

    }

    @Override
    public void onSurfaceChanged(int width, int height) {
        mPoss = new ArrayList<>(DISPLAY_SIZE);
        mSizes = new ArrayList<>(DISPLAY_SIZE);
        mPoss.add(new Point(0, 0));
        mSizes.add(new Point(width, height));
        Log.d("FUYAO_SingleStrategy2", "onSurfaceChanged mSizes = " + mSizes + " mPoss = " + mPoss);
    }

    @Override
    public int getVisibleSize() {
        return DISPLAY_SIZE;
    }

    @Override
    public List<Point> getDisplayPoss() {
        return mPoss;
    }

    @Override
    public List<Point> getDisplaySizes() {
        return mSizes;
    }
}
